package com.chenyongjing.design.pattern.visitor.kpi;

import java.util.LinkedList;
import java.util.List;

/**
 * 报表
 * @Author chen
 * @Date 2022/12/8 22:58
 */
public class BusinessReport {
    private List<Employee> employees = new LinkedList<>();

    public BusinessReport(){
        employees.add(new Manager("产品经理A"));
        employees.add(new Manager("产品经理B"));
        employees.add(new Engineer("程序员A"));
        employees.add(new Engineer("程序员B"));
        employees.add(new Engineer("程序员C"));
        employees.add(new Engineer("程序员D"));
    }

    /**
     * 实现伪动态多分派
     * @param visitor
     */
    public void showReport(IVisitor visitor){
        for (Employee employee : employees){
            employee.accept(visitor);
        }
    }
}
